//
 
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>


NS_ASSUME_NONNULL_BEGIN

@interface MB_SqlView : NSObject
//
@property (nonatomic,copy,readonly) NSString *dataName;
//
@property (nonatomic,copy,readonly) NSString *entityName;
//
@property (nonatomic,strong) NSManagedObjectContext *msContext;
//
@property (nonatomic,strong) NSManagedObjectModel *objModel;
//
@property (nonatomic,strong) NSPersistentStoreCoordinator *persistent;


- (instancetype)initWithData:(NSString *)entityName dataName:(NSString *)dataName success:(void(^)(void))success fail:(void(^)(NSError *__nullable error))fail;
//
- (void)mb_insertNewEntity:(NSDictionary *)dict success:(void(^)(void))success fail:(void(^)(NSError *__nullable error))fail;

//
- (void)mb_readEntity:(NSArray *__nullable)sequenceKeys ascending:(BOOL)isAscending filterStr:(NSString *__nullable)filterStr success:(void(^)(NSArray *results))success fail:(void(^)(NSError *__nullable error))fail;

//
- (void)mb_deleteEntity:(NSManagedObject *__nullable)obj key:(id __nullable)key success:(void (^)(void))success fail:(void (^)(NSError *__nullable error))fail;

//
- (void)mb_updateEntity:(NSDictionary *)dict key:(id __nullable)key success:(void(^)(void))success fail:(void(^)(NSError *__nullable error))fail;


@end

NS_ASSUME_NONNULL_END
